/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package putime.newspaperagent.main;

import javax.swing.JFrame;
import putime.newspaperagent.product.frmProduct;
import putime.newspaperagent.supplier.frmSupplier;

/**
 *
 * @author Administrator
 */
public class frmMain extends javax.swing.JFrame {

    /**
     * Creates new form frmMain
     */
    JFrame current;
    public frmMain() {
        initComponents();
        setLocationRelativeTo(this);
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jMenuBar1 = new javax.swing.JMenuBar();
        jMenu1 = new javax.swing.JMenu();
        jMenuItem2 = new javax.swing.JMenuItem();
        jMenuItem3 = new javax.swing.JMenuItem();
        jMenuItem4 = new javax.swing.JMenuItem();
        jMenu2 = new javax.swing.JMenu();
        mniProduct = new javax.swing.JMenuItem();
        mniSupplier = new javax.swing.JMenuItem();
        jSeparator1 = new javax.swing.JPopupMenu.Separator();
        mniCustomer = new javax.swing.JMenuItem();
        mniLine = new javax.swing.JMenuItem();
        jSeparator2 = new javax.swing.JPopupMenu.Separator();
        mniPaymentReceiver = new javax.swing.JMenuItem();
        jMenu3 = new javax.swing.JMenu();
        jMenu4 = new javax.swing.JMenu();
        jMenu5 = new javax.swing.JMenu();
        jMenu6 = new javax.swing.JMenu();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setPreferredSize(new java.awt.Dimension(799, 600));

        jMenu1.setText("File");

        jMenuItem2.setText("jMenuItem2");
        jMenu1.add(jMenuItem2);

        jMenuItem3.setText("jMenuItem3");
        jMenu1.add(jMenuItem3);

        jMenuItem4.setText("jMenuItem4");
        jMenu1.add(jMenuItem4);

        jMenuBar1.add(jMenu1);

        jMenu2.setText("Master");

        mniProduct.setText("Product");
        mniProduct.setPreferredSize(new java.awt.Dimension(89, 22));
        mniProduct.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                mniProductActionPerformed(evt);
            }
        });
        jMenu2.add(mniProduct);

        mniSupplier.setText("Superlier");
        mniSupplier.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                mniSupplierActionPerformed(evt);
            }
        });
        jMenu2.add(mniSupplier);
        jMenu2.add(jSeparator1);

        mniCustomer.setText("Customer");
        jMenu2.add(mniCustomer);

        mniLine.setText("Line");
        jMenu2.add(mniLine);
        jMenu2.add(jSeparator2);

        mniPaymentReceiver.setText("Payment Receiver");
        jMenu2.add(mniPaymentReceiver);

        jMenuBar1.add(jMenu2);

        jMenu3.setText("Transaction");
        jMenuBar1.add(jMenu3);

        jMenu4.setText("Bill");
        jMenuBar1.add(jMenu4);

        jMenu5.setText("Administrator");
        jMenuBar1.add(jMenu5);

        jMenu6.setText("Helps");
        jMenuBar1.add(jMenu6);

        setJMenuBar(jMenuBar1);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 1000, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 779, Short.MAX_VALUE)
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void mniProductActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mniProductActionPerformed
        // TODO add your handling code here:
        if(current!=null)
        {
        current.setVisible(false);
        }
        frmProduct frm=new frmProduct();
        frm.setVisible(true);
        current=frm;
        
    }//GEN-LAST:event_mniProductActionPerformed

    private void mniSupplierActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mniSupplierActionPerformed
        // TODO add your handling code here:
        current.setVisible(false);
        frmSupplier frm=new frmSupplier();
        frm.setVisible(true);
        current=frm;
    }//GEN-LAST:event_mniSupplierActionPerformed

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(frmMain.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(frmMain.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(frmMain.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(frmMain.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new frmMain().setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JMenu jMenu1;
    private javax.swing.JMenu jMenu2;
    private javax.swing.JMenu jMenu3;
    private javax.swing.JMenu jMenu4;
    private javax.swing.JMenu jMenu5;
    private javax.swing.JMenu jMenu6;
    private javax.swing.JMenuBar jMenuBar1;
    private javax.swing.JMenuItem jMenuItem2;
    private javax.swing.JMenuItem jMenuItem3;
    private javax.swing.JMenuItem jMenuItem4;
    private javax.swing.JPopupMenu.Separator jSeparator1;
    private javax.swing.JPopupMenu.Separator jSeparator2;
    private javax.swing.JMenuItem mniCustomer;
    private javax.swing.JMenuItem mniLine;
    private javax.swing.JMenuItem mniPaymentReceiver;
    private javax.swing.JMenuItem mniProduct;
    private javax.swing.JMenuItem mniSupplier;
    // End of variables declaration//GEN-END:variables
}
